<?php

use Dingo\Api\Routing\Router;
use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function (Router $api) {

    $api->any('tt', 'App\Api\V1\Controllers\IndexController@tt');

    $api->any('login', 'App\Api\V1\Controllers\UserController@login');
    $api->any('app-login', 'App\Api\V1\Controllers\UserController@app_login');
    $api->any('register', 'App\Api\V1\Controllers\UserController@register');

    $api->get('index-data', '\App\Api\V1\Controllers\IndexController@get_index_data');
    $api->get('news-info', '\App\Api\V1\Controllers\NewsController@get_news_info');

    $api->get('group-index','\App\Api\V1\Controllers\GroupController@index');


    $api->group(['middleware' => ['api.auth']], function (Router $api) {
        $api->any('user-info','App\Api\V1\Controllers\UserController@info');
        $api->any('news-zan', '\App\Api\V1\Controllers\NewsController@zan');
        $api->any('follow-media', '\App\Api\V1\Controllers\UserController@follow_media');
        $api->any('news_add_comment','\App\Api\V1\Controllers\NewsController@add_comment');
    });
});
